﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Texfina.Core.Data;
using System.Data;
using Texfina.Entity.Co;

namespace Texfina.DOQry.Co
{
    public class DImportacion
    {

        public static DataSet GetList(EImportacion imp)
        {

            DBAccess db = new DBAccess();

            db.AddParameter("@idImporta", imp.Id_importa);

            db.AddParameter("@dsImporta", imp.Ds_importa);

            return db.ExecuteDataSet("MG_Importacion_qry01");
        }

        /// <summary>
        /// generar codigo
        /// </summary>
        /// <returns></returns>
        public static IDataReader Importacion_qry01()
        {
            DBAccess db = new DBAccess();

            return db.ExecuteReader("MG_GencodigoImportacion");
        }

        public static IDataReader GetList02(EImportacion imp)
        {

            DBAccess db = new DBAccess();

            db.AddParameter("@idImporta", imp.Id_importa);

            db.AddParameter("@dsImporta", imp.Ds_importa);

            return db.ExecuteReader("MG_Importacion_qry01");
        }

        public static void Importacion_mnt01(EImportacion imp)
        {
            DBAccess db = new DBAccess();

            db.AddParameter("@pid_importa", imp.Id_importa);
            db.AddParameter("@pds_importa", imp.Ds_importa);
            db.AddParameter("@pid_via", imp.Id_via);
            db.AddParameter("@pid_tercom", imp.Id_tercom);
            db.AddParameter("@pid_ucrearec", imp.Id_ucrearec);
            db.AddParameter("@pid_uupdarec", imp.Id_uupdarec);

            db.ExecuteNonQuery("MG_Importacion_mnt01");

        }
    }
}
